package app.inmos.adapters;

import android.app.Fragment;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import app.inmos.build.R;
import app.inmos.constants.Constantes;
import app.inmos.exception.InmobiliariaNoEncontradaException;
import app.inmos.functions.json.InmobiliariaUtilsJSON;
import app.inmos.model.Inmobiliaria;


public class InmobiliariaAdapter extends BaseAdapter{
	
   protected Fragment fragment;
   protected Inmobiliaria inmobiliaria;
   
   static class ViewHolder
	{
		TextView tquienesSomos;
		TextView tvtitulo_post;
		
	}

   
	 
   public InmobiliariaAdapter(Fragment pFragment,Inmobiliaria pInmobiliaria) {
	   
		    this.fragment = pFragment;
		    setInmobiliaria(pInmobiliaria);
   }

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		 View vi=convertView;
		 ViewHolder holder;
         
		    if(convertView == null) {
		      LayoutInflater inflater = (LayoutInflater) fragment.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		      vi = inflater.inflate(R.layout.pestania_empresa, null);
		    }
		      
		    holder = new ViewHolder();
		    holder.tquienesSomos=(TextView) vi.findViewById(R.id.qsomosCompletar);
		    convertView.setTag(holder);    
		     
		    try{
		    	
		       holder.tquienesSomos.setText(InmobiliariaUtilsJSON.getInstance().getInmobiliaria().getDescripcion());    
		    
		    }
		    
		    catch(InmobiliariaNoEncontradaException ine){
		    	
		    	holder.tquienesSomos.setText(Constantes.MSJ_INFO_NO_DISPONIBLE);
		    	
		      	
		    }
		
	
		 
		 return vi;
	}

	

	public Fragment getFragment() {
		return fragment;
	}

	public void setFragment(Fragment fragment) {
		this.fragment = fragment;
	}

	public Inmobiliaria getInmobiliaria() {
		return inmobiliaria;
	}

	public void setInmobiliaria(Inmobiliaria inmobiliaria) {
		this.inmobiliaria = inmobiliaria;
	}
	
	
	

}
